<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>新增种子·思通投研·让数据驱动投资价值!</title>
	
	<link href="${pageContext.request.contextPath }/img/webLogoIcon.png" rel="shortcut icon">
    <link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/font-awesome.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/custom.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/style.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/datatables.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/toastr.min.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath }/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
    <style>
		.select2_demo_1 {
			float: left;
			width: 120px;
			display: inline;
			margin-left: 10px;
		}
		
		.form-control {
			display: inline;
		}
		
		.col-sm-3 {
			float: right;
			width: 560px;
		}
		
		.input-group {
			float: right;
			width: 240px;
			margin-left: 5px;
		}
		
		.checkbox {
		    padding-left: 35px;
		    float: left;
		}
	</style>
</head>

<body>

    <div id="wrapper">

        <nav class="navbar-default navbar-static-side" role="navigation">
        	<%request.setAttribute("LEFT", "websitelist");%>
			<%@include file="left-factory.jsp"%>
        </nav>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
        <jsp:include page="head-factory.jsp" flush="true" />
        </div>
            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>新增种子</h2>
                </div>
            </div>
        <div class="wrapper wrapper-content">
            <div class="ibox-content">
            	<form action="${pageContext.request.contextPath}/spiderconfig/test" method="post"  target="_blank">
            	<span style="font-size: 17px;" id="websiteId" data-id="${websiteId }">网站名称:${websitename } </span>
            	<button class="btn btn-white pull-right" onclick="javascrtpt:window.location.href='${pageContext.request.contextPath }/listseed?websiteId=${websiteId}'" type="button">返回</button>
                <div class="table-responsive" style="margin-top: 5%;">
                	<div class="search-result">
                    	<span style="font-size: 17px;">添加一个在【${websitename }】下种子地址配置信息</span> 
                    	<div style="display: inline;float: right;">
										线程数:<select class="form-control" style="display: inline;width: auto;"
											id="seedthreadconfig" name="seedthreadconfig">
											<option value="1" selected>1条</option>
											<option value="5">5条</option>
											<option value="10">10条</option>
										</select>
										&nbsp;&nbsp;&nbsp;&nbsp;抓取间隔:<select class="form-control" style="display: inline;width: auto;"
											id="seedintervalconfig" name="seedintervalconfig">
											<option value="60000">1分钟</option>
											<option value="600000" selected>10分钟</option>
											<option value="1800000">30分钟</option>
											<option value="3600000">60分钟</option>
										</select>
										&nbsp;&nbsp;&nbsp;&nbsp;访问URL间隔:<select class="form-control" style="display: inline;width: auto;"
											id="seedsleepconfig" name="seedsleepconfig">
											<option value="1000">1秒</option>
											<option value="2000">2秒</option>
											<option value="3000">3秒</option>
											<option value="4000">4秒</option>
											<option value="5000" selected>5秒</option>
										</select>
									</div>
			                    </div>
							<div class="hr-line-dashed"></div>
                    
                    <div class="panel-body">
					
                          <fieldset class="form-horizontal" style="margin-top: 3%;">
                          
                            		<div class="form-group"><label class="col-sm-2 control-label">选择配置方式:</label>
                                        <div class="col-sm-10"><div class="btn-group">
                                <button id="smartbutton" class="btn btn-white active" type="button" onclick="configTypeChange(1)">智能配置</button>
                                <button id="manualbutton" class="btn btn-white" type="button" onclick="configTypeChange(2)">手动配置</button>
                            </div></div>
                                    </div>
<!--                                     <div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置存储板块:</label> -->
<!-- 									<select id="se1" name="seedid" class="form-control" style="display: inline;width: auto;margin-left:15px;"> -->
<!-- 							    </select> -->
<!-- 									</div> -->
									
<!-- 									<div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置文章分类:</label> -->
<!-- 									<select id="se2" name="seedid" class="form-control" style="display: inline;width: auto;margin-left:15px;"> -->
<!-- 									<option>请选择</option> -->
<!-- 							    </select> -->
<!-- 									</div> -->
									<div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;"></span>是否使用代理:</label>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <div id="daili" class="radio-inline">
										  <input type="radio"  name="killOrder1" value="1"/>
										  <label for="killOrder1">是</label>
										</div>
										<div class="radio-inline">
										  <input type="radio"  name="killOrder1" value="0" checked/>
										  <label for="killOrder1">否</label>
										</div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label">是否使用Selenium:</label>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <div id="selenium" class="radio-inline">
										  <input type="radio"  name="killOrder2" value="1"/>
										  <label for="killOrder2">是</label>
										</div>
										<div class="radio-inline">
										  <input type="radio"  name="killOrder2" value="0" checked/>
										  <label for="killOrder2">否</label>
										</div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>种子地址名称:</label>
                                        <div class="col-sm-10"><input type="text" id="seedname" name="seedname" class="form-control" style="width: 88%;" placeholder="请输入您需要采集的地址名称，例如：北京晨报-国际要闻"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>种子地址列表:</label>
                                        <div class="col-sm-10"><input type="text" id="seedurllist" name="seedurllist" class="form-control" style="width: 88%;" placeholder="请输入URL的列表采集地址"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置正文类型:</label>
                                        <select class="form-control" style="display: inline;width: auto;margin-left:15px;"
										id="seedtype" name="seedtype">
												<option value="0">选择列表页类型</option>
												<option value="1" selected>HTML</option>
												<option value="2">JSON</option>
												<option value="3">HTML>CDATA</option>
												<option value="4">HTML>JavaScript</option>
											</select>
									</div>
<!-- 									<div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;"></span>列表页请求方式:</label> -->
<!--                                         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
<!--                                         <div id="daili" class="radio-inline"> -->
<!-- 										  <input type="radio"  name="killOrder3" value="1" checked/> -->
<!-- 										  <label for="killOrder3">GET</label> -->
<!-- 										</div> -->
<!-- 										<div class="radio-inline"> -->
<!-- 										  <input type="radio"  name="killOrder3" value="2"/> -->
<!-- 										  <label for="killOrder3">POST</label> -->
<!-- 										</div> -->
<!--                                     </div> -->
                                    <div class="form-group"><label class="col-sm-2 control-label">配置列表请求规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedlistrequestparam" name="seedlistrequestparam" class="form-control" style="width: 88%;" placeholder='填写请求类型和参数Referer等,如{"type":"POST","param":{"v":"1","_v":"j87","a":"490183973","t":"pageview","_s":"1"}}'></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置列表规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedurlconfig" name="seedurlconfig" class="form-control" style="width: 88%;" placeholder="请输入列表页Xpath"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label">配置路径规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedlinkurlconfig" name="seedlinkurlconfig" class="form-control" style="width: 88%;" placeholder="需要拼接url时填入此项"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置存储规则:</label>
                                    	<div class="checkbox">
                                      <input id="checkbox1" name="seedtextStorageJson" type="checkbox" value="1" class="seedtextStorageJson" checked>
                                      <label for="checkbox1">MySQL</label>
                                 	 </div>
                                 	 <div class="checkbox">
                                  		<input id="checkbox2" name="seedtextStorageJson" type="checkbox" value="2" class="seedtextStorageJson">
                                      	<label for="checkbox2">MongoDB</label>
                                  	</div>
                                  	<input id="spiderId" name="spiderId" type="hidden" value="1">
                                 	 <div class="checkbox">
                                  		<input id="checkbox3" name="seedtextStorageJson" type="checkbox" value="3" class="seedtextStorageJson">
                                     	 <label for="checkbox3">ES</label>
                                 	 </div>
									</div>
									<div class="form-group"><label class="col-sm-2 control-label">配置作者规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedauthorconfig" name="seedauthorconfig" class="form-control" style="width: 88%;" placeholder="需要作者填入此项"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label">配置作者主页规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedauthorurlconfig" name="seedauthorurlconfig" class="form-control" style="width: 88%;" placeholder="需要拼接作者主页时填入此项"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label">配置作者头像规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedauthoravatarconfig" name="seedauthoravatarconfig" class="form-control" style="width: 88%;" placeholder="需要拼接作者头像时填入此项"></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label">配置分页json规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedpageruleconfig" name="seedpageruleconfig" class="form-control" style="width: 88%;" placeholder='需要分页抓取时填入此项,demo:{"replace_demo":"_*","replace_rule":"*-1","first":"","pagenum":"200"}'></div>
                                    </div>
                                    <div class="form-group"><label class="col-sm-2 control-label">配置列表请求规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedlitrequestparam" name="seedlitrequestparam" class="form-control" style="width: 88%;" placeholder='需要拼接详情页请求时需要参数填入此项 如Referer Query String Parameters 等'></div>
                                    </div>
                                    <div class="form-group configtype" style="display:none"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置标题规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedtitleconfig" name="seedtitleconfig" class="form-control" style="width: 88%;" placeholder="请输入标题解析代码"></div>
                                    </div>
                                    <div class="form-group configtype" style="display:none"><label class="col-sm-2 control-label">配置来源规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedoriginconfig" name="seedoriginconfig" class="form-control" style="width: 88%;" placeholder="请输入来源解析代码"></div>
                                    </div>
                                    <div class="form-group configtype" style="display:none"><label class="col-sm-2 control-label">配置来源URL规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedoriginurlconfig" name="seedoriginurlconfig" class="form-control" style="width: 88%;" placeholder="请输入来源URL解析代码"></div>
                                    </div>
                                    <div class="form-group configtype" style="display:none"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>配置日期规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seeddateconfig" name="seeddateconfig" class="form-control" style="width: 88%;" placeholder="请输入日期解析代码"></div>
                                    </div>
									<div class="form-group configtype" style="display:none"><label class="col-sm-2 control-label"><span style="color:red;font-size:16px;line-height:0px;">*</span>正文解析规则:</label>
                                        <div class="col-sm-10"><input type="text" id="seedtextconfig" name="seedtextconfig" class="form-control" style="width: 88%;" placeholder="请输入正文解析规则"></div>
                                    </div>
                                </fieldset>
                                <button class="btn btn-primary"style="margin-left: 20%;margin-top: 2%;" onclick="check()" type="submit">测试种子</button>
                                <button class="btn btn-primary"style="margin-left: 38%;margin-top: 2%;" id="addbutton" onclick="addSmartSeed()" type="button">添加</button>
                        </div>
                   </div>
                   </form>
                </div>
            </div>
			<jsp:include page="footer.jsp" flush="true" />
        </div>
        </div>



    <!-- Mainly scripts -->
    <script src="${pageContext.request.contextPath }/js/jquery-2.1.1.js"></script>
    <script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.slimscroll.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.jeditable.js"></script>
    <script src="${pageContext.request.contextPath }/js/datatables.min.js"></script>
    
    <!-- Peity -->
    <script src="${pageContext.request.contextPath }/js/jquery.peity.min.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="${pageContext.request.contextPath }/js/inspinia.js"></script>
    <script src="${pageContext.request.contextPath }/js/pace.min.js"></script>

    <!-- Peity -->
    <script src="${pageContext.request.contextPath }/js/peity-demo.js"></script>

	<!-- toastr -->
	<script src="${pageContext.request.contextPath }/js/plugins/toastr/toastr.min.js"></script>
	<!-- Sweet alert -->
	<script src="${pageContext.request.contextPath }/js/plugins/sweetalert/sweetalert.min.js"></script>
	
	
    <script src="${pageContext.request.contextPath }/js/jquery.searchableSelect.js"></script>
    <!-- Page-Level Scripts -->
    <script>
//     $(function() {
//     	$.ajax({
// 	        type:"POST",
// 	        url:"${pageContext.request.contextPath}/news/getSeedIds",
// 	        data:{},
// 			dataType:'json',
// 			success:function(data){
// 		  		var htmlStr = "";
// 		  		var length = data.length;
// 		  			htmlStr +="<option value=''>请选择</option>";
// 		  			for(j=0;j<length;j++){
// 		  					htmlStr += "<option value='"+ data[j].seed_id +"'>"
// 				  			+data[j].seed_name+"</option>";
// 		  			}
// 				$('#se1').html(htmlStr);
// 			},
// 		});
//       });
//     $("#se1").on('change',function(){
// 		$.ajax({
// 			url:"${pageContext.request.contextPath}/news/getType",
// 			type:"post",
// 			data:{
// 				flag:$("#se1").val()
// 			},
// 			success:function(data){
// 				data = JSON.parse(data);
// 				console.log(data)
// 				var htmlStr = "";
// 		  		var length = data.length;
// 		  			htmlStr +="<option value=''>请选择</option>";
// 		  			var seed_type_id = $('#se2').attr("data-id");
// 		  			for(j=0;j<length;j++){
// 		  				if(!(!seed_type_id)){
// 		  				if(seed_type_id == data[j].seed_id){
// 		  					htmlStr += "<option value='"+ data[j].seed_id +"'  selected = 'selected' >"
// 				  			+data[j].seed_name+"</option>";
// 		  				}else{
// 		  					htmlStr += "<option value='"+ data[j].seed_id +"'>"
// 				  			+data[j].seed_name+"</option>";
// 		  				}
// 	  				}else{
// 	  					htmlStr += "<option value='"+ data[j].seed_id +"'>"
// 			  			+data[j].seed_name+"</option>";
// 	  				}
// 		  			}
// 		  		$("#se2").html("");
// 				$('#se2').html(htmlStr);
// 			},
// 			error:function(e){
				
// 			}
// 		})
// 	})
    function configTypeChange(num){
		if(num == 1){
			$("#smartbutton").attr("class","btn btn-white active")
			$("#manualbutton").attr("class","btn btn-white")
			$(".configtype").attr("style","display: none;")
			$("#addbutton").attr("onclick","addSmartSeed()")
			$("#spiderId").val(1)
		}else if(num == 2){
			$("#smartbutton").attr("class","btn btn-white")
			$("#manualbutton").attr("class","btn btn-white active")
			$(".configtype").attr("style","display:block;")
			$("#addbutton").attr("onclick","addSeed()")
			$("#spiderId").val(2)
		}
	}
    function addSmartSeed(){
    	if($("#seedname").val()==null||$("#seedname").val()=="")
    	{
    		toastr.error('请填写需要采集的地址名')
    		return;
    	}else if($("#seedurllist").val()==null||$("#seedurllist").val()=="")
    	{
    		toastr.error('请填写需要采集的地址列表')
    		return;
    	}else if($("#seedtype").val()==null||$("#seedtype").val()==0)
    	{
    		toastr.error('请填写需要配置的正文类型')
    		return;
    	}else if($("#seedurlconfig").val()==null||$("#seedurlconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的列表规则')
    		return;
    	}else if(!$("#checkbox1").prop('checked')&&!$("#checkbox2").prop('checked')&&!$("#checkbox3").prop('checked'))
    	{
    		toastr.error('请选择需要配置的存储规则')
    		return;
    	}
//     	else if($("#se1").val()==null||$("#se1").val()=="")
//     	{
//     		toastr.error('请选择存储板块')
//     		return;
//     	}else if($("#se2").val()==null||$("#se2").val()=="")
//     	{
//     		toastr.error('请选择文章的分类')
//     		return;
//     	}
//     	var sRegex = '(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]';
//     	var re = new RegExp(sRegex);
//     	if (!re.test($("#seedurllist").val())) {
//         	toastr.error('url填写不正确')
//         	return;
//         }
    	swal({
            title: "确定添加该种子?",
//          text: "Your will not be able to recover this imaginary file!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            closeOnConfirm: false,
            closeOnCancel: true },
        function (isConfirm) {
            if (isConfirm) {
               var data
            	   data = {
            			websiteId : $("#websiteId").attr("data-id"),
            			seedthreadconfig : $("#seedthreadconfig").val(),
            			seedintervalconfig : $("#seedintervalconfig").val(),
            			seedsleepconfig : $("#seedsleepconfig").val(),
            			seedname : $("#seedname").val(),
            			seedurllist : $("#seedurllist").val(),
            			seedstoragejson : $("input:checkbox[name='seedtextStorageJson']:checked").map(function(index,elem) {
            	            return $(elem).val();
            	        }).get().join(','),
            			seedtextconfigtype : $("#seedtype").val(),
            			seedtype : $("#seedtype").val(),
            			seedurlconfig : $("#seedurlconfig").val(),
            			seedlinkurlconfig : $("#seedlinkurlconfig").val(),
//             			seedarticletype : $("#se2").val(),
            			seedspidertype : 1,
            			dailiflag : $("input[name='killOrder1']:checked").val(),
            			seleniumflag : $("input[name='killOrder2']:checked").val(),
//             			otherseedid:$('#se1').val(),
						seedpageruleconfig:$("#seedpageruleconfig").val(),
						seedauthorconfig:$("#seedauthorconfig").val(),
						seedauthorurlconfig:$("#seedauthorurlconfig").val(),
						seedauthoravatarconfig:$("#seedauthoravatarconfig").val(),
            			otherwebsiteId:$("#websiteId").attr("data-id")
            		}
//                }
                $.ajax({
            		url : "${pageContext.request.contextPath}/insertseed",
            		type : "post",
            		data : data,
            		success : function(res) {
            			console.log(res)
            			if (res.status == 200) {
            				//toastr.success(res.msg);
            				 swal("添加成功", "该种子已被添加", "success");
            				 setTimeout(() => {
             					window.location.href = "${pageContext.request.contextPath}/listseed?websiteId="+${websiteId};
         					}, 3000);
            			} else {
            				//toastr.error(res.msg);
            				swal("添加失败", "该种子已被添加", "error");
            			}
            		},
            		error : function(e) {
            			//toastr.error(res.msg);
            			swal("添加失败", "该种子已被添加", "error");
            			window.clearInterval(timer);
            		}
            	});
            }
        });
    	
    	

    	/* text = $("input:checkbox[name='seedtextStorageJson']:checked").map(function(index,elem) {
            return $(elem).val();
        }).get().join(','); */
    	
    }
    function addSeed(){
    	if($("#seedname").val()==null||$("#seedname").val()=="")
    	{
    		toastr.error('请填写需要采集的地址名')
    		return;
    	}else if($("#seedurllist").val()==null||$("#seedurllist").val()=="")
    	{
    		toastr.error('请填写需要采集的地址列表')
    		return;
    	}else if($("#seedtype").val()==null||$("#seedtype").val()==0)
    	{
    		toastr.error('请填写需要配置的正文类型')
    		return;
    	}else if($("#seedurlconfig").val()==null||$("#seedurlconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的列表规则')
    		return;
    	}else if($("#seedtitleconfig").val()==null||$("#seedtitleconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的标题规则')
    		return;
    	}else if($("#seeddateconfig").val()==null||$("#seeddateconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的日期规则')
    		return;
    	}else if(!$("#checkbox1").prop('checked')&&!$("#checkbox2").prop('checked')&&!$("#checkbox3").prop('checked'))
    	{
    		toastr.error('请选择需要配置的存储规则')
    		return;
    	}else if($("#seedtextconfig").val()==null||$("#seedtextconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的正文规则')
    		return;
    	}
//     	else if($("#se1").val()==null||$("#se1").val()=="")
//     	{
//     		toastr.error('请选择存储板块')
//     		return;
//     	}else if($("#se2").val()==null||$("#se2").val()=="")
//     	{
//     		toastr.error('请选择文章的分类')
//     		return;
//     	}
    	var sRegex = '(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]';
    	var re = new RegExp(sRegex);
    	if (!re.test($("#seedurllist").val())) {
        	toastr.error('url填写不正确')
        	return;
        }

     	   data = {
     			seedname : $("#seedname").val(),
      			seedtype : $("#seedtype").val(),
      			websiteId : $("#websiteId").attr("data-id"),
      			seeddateconfig : $("#seeddateconfig").val(),
      			seedintervalconfig : $("#seedintervalconfig").val(),
      			seedsleepconfig : $("#seedsleepconfig").val(),
      			seedurllist : $("#seedurllist").val(),
      			seedstoragejson : $("input:checkbox[name='seedtextStorageJson']:checked").map(function(index,elem) {
      	            return $(elem).val();
      	        }).get().join(','),
      			seedtextconfig : $("#seedtextconfig").val(),
      			seedtextconfigtype : $("#seedtype").val(),
      			seedthreadconfig : $("#seedthreadconfig").val(),
      			seedtitleconfig : $("#seedtitleconfig").val(),
      			seedurlconfig : $("#seedurlconfig").val(),
      			seeddateconfig : $("#seeddateconfig").val(),
      			seedlinkurlconfig : $("#seedlinkurlconfig").val(),
      			seedoriginconfig : $("#seedoriginconfig").val(),
      			seedoriginurlconfig : $("#seedoriginurlconfig").val(),
      			dailiflag : $("input[name='killOrder1']:checked").val(),
    			seleniumflag : $("input[name='killOrder2']:checked").val(),
//       			seedarticletype : $("#se2").val(),
      			seedspidertype : 2,
//       			otherseedid:$('#se1').val(),
				seedauthorconfig:$("#seedauthorconfig").val(),
				seedpageruleconfig:$("#seedpageruleconfig").val(),
				seedauthorurlconfig:$("#seedauthorurlconfig").val(),
				seedauthoravatarconfig:$("#seedauthoravatarconfig").val(),
      			otherwebsiteId:$("#websiteId").attr("data-id")
     		}
//         }
    	$.ajax({
    		url : "${pageContext.request.contextPath}/insertseed",
    		type : "post",
    		data : data,
    		success : function(res) {
    			console.log(res)
    			if (res.status == 200) {
    				toastr.success(res.msg);
    				setTimeout(() => {
    					window.location.href = "${pageContext.request.contextPath}/listseed?websiteId="+${websiteId};
					}, 3000);
    			} else {
    				toastr.error(res.msg);
    			}
    		},
    		error : function(e) {
    			toastr.error(res.msg);
    			window.clearInterval(timer);
    		}
    	});
    }
  function check(){
    	
    	if($("#seedname").val()==null||$("#seedname").val()=="")
    	{
    		toastr.error('请填写需要采集的地址名')
    		return;
    	}else if($("#seedurllist").val()==null||$("#seedurllist").val()=="")
    	{
    		toastr.error('请填写需要采集的地址列表')
    		return;
    	}else if($("#seedtype").val()==null||$("#seedtype").val()==0)
    	{
    		toastr.error('请填写需要配置的正文类型')
    		return;
    	}else if($("#seedurlconfig").val()==null||$("#seedurlconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的列表规则')
    		return;
    	}else if($("#seedtitleconfig").val()==null||$("#seedtitleconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的标题规则')
    		return;
    	}else if($("#seeddateconfig").val()==null||$("#seeddateconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的日期规则')
    		return;
    	}else if(!$("#checkbox1").prop('checked')&&!$("#checkbox2").prop('checked')&&!$("#checkbox3").prop('checked'))
    	{
    		toastr.error('请选择需要配置的存储规则')
    		return;
    	}else if($("#seedtextconfig").val()==null||$("#seedtextconfig").val()=="")
    	{
    		toastr.error('请填写需要配置的正文规则')
    		return;
    	}
//     	var sRegex = '^((https|http|ftp|rtsp|mms)?://)' + '?(([0-9a-z_!~*\'().&=+$%-]+: )?[0-9a-z_!~*\'().&=+$%-]+@)?'
//         + '(([0-9]{1,3}.){3}[0-9]{1,3}'
//         + '|' 
//         + '([0-9a-z_!~*\'()-]+.)*'
//         + '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].'
//         + '[a-z]{2,6})'
//         + '(:[0-9]{1,4})?'
//         + '((/?)|'
//         + '(/[0-9a-z_!~*\'().;?:@&=+$,%#-]+)+/?)$';
//     	var re = new RegExp(sRegex);
//     	if (!re.test($("#seedurllist").val())) {
//         	toastr.error('url填写不正确')
//         	return;
//         }
    	
    	
    	/* var seedtype = $("#seedtype").val();
    	var seedtextconfig = $("#seedtextconfig").val();
    	var seedthreadconfig = $("#seedthreadconfig").val();
    	var seedtitleconfig = $("#seedtitleconfig").val();
    	var seedurlconfig = $("#seedurlconfig").val();
    	var seedurllist = $("#seedurllist").val();
    	var seeddateconfig = $("#seeddateconfig").val();
    	var seedlinkurlconfig = $("#seedlinkurlconfig").val();
    	var seedoriginconfig = $("#seedoriginconfig").val();
    	var seedoriginurlconfig = $("#seedoriginurlconfig").val();
    	var seedsleepconfig = $("#seedsleepconfig").val(); */
    	
    	
    	
    	
    	
    	/* window.open("${pageContext.request.contextPath}/spiderconfig/test?seedtype="+$("#seedtype").val()+"&seeddateconfig="
    			+$("#seeddateconfig").val()+"&seedintervalconfig="+$("#seedintervalconfig").val()
    			+"&seedsleepconfig="+$("#seedsleepconfig").val()
    			+"&seedurllist="+$("#seedurllist").val()+"&seedtextconfig="+$("#seedtextconfig").val()+
    			"&seedthreadconfig="+$("#seedthreadconfig").val()+"&seedtitleconfig="+$("#seedtitleconfig").val()
    			+"&seedurlconfig="+$("#seedurlconfig").val()+"&seedlinkurlconfig="+$("#seedlinkurlconfig").val()
    			+"&seedoriginconfig="+$("#seedoriginconfig").val()); */
    }
  
  
  
//跑马灯方法 
// 	 function init(){
// 		    //获取标题
// 		    var title=document.title;
// 		    //分割字符串--->字符数组
// 		    var arr=title.split("");
// 		    //删除第一个元素并返回该元素
// 		    var e=arr.shift();
// 		    //把一个对象添加到数组末尾
// 		    arr.push(e);
// 		    //把数组转换成字符串
// 		    var marquee=arr.join("");
// 		    //返回给浏览器
// 		    document.title=marquee;
// 		    //定时一直执行
// 		    window.setTimeout("init()",1000);
// 		}
// 		window.onload=init;
	 
    </script>

</body>

</html>
